# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=py3-pyparted
_pkgname=pyparted
pkgver=3.13.0
pkgrel=1
pkgdesc="Python bindings for GNU parted (libparted)"
url="https://github.com/dcantrell/pyparted"
arch="all"
license="GPL-2.0-or-later"
makedepends="
	parted-dev
	py3-gpep517
	py3-setuptools
	py3-wheel
	python3-dev
	"
checkdepends="
	e2fsprogs
	"
subpackages="$pkgname-pyc"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/dcantrell/pyparted/archive/v$pkgver.tar.gz
	archlabels-armv8l.patch
	"
builddir="$srcdir/$_pkgname-$pkgver"

replaces=py-pyparted # Backwards compatibility
provides=py-pyparted=$pkgver-r$pkgrel # Backwards compatibility

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m unittest discover
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
26819e28d73420937874f52fda03eb50ab1b136574ea9867a69d46ae4976d38c4f26a2697fa70597eed90dd78a5ea209bafcc3227a17a7a5d63cff6d107c2b11  py3-pyparted-3.13.0.tar.gz
1b2e92b83df51e4c2fe44f67b3ea21839614ab4613d4c32b5875f9fbf364fd6c9c85fa2400b55b84d4f64435f98f8e22f93c1db9d882ed9658379b20fe76e0d8  archlabels-armv8l.patch
"
